#!/usr/bin/env python
import pyaudio

################################################################################

# ROS configuration
PACKAGE_NAME = "speech_recognition"
ASR_NODE_NAME = "speech_recognizer"
INPUT_NODE_NAME = "speech_input"
ASR_OUTPUT_TOPIC = "speech/recognition_output"
ASR_CHANGEMODE_TOPIC = "speech/change_mode"
ASR_MSGS_TOPIC = "speech/recognition_system_msgs"

################################################################################

# Audio device parameters
DEVICE_NAME = "USB Audio"
RATE = 16000
NUM_CHANNELS = 1
CHUNK_SIZE = 1024
FORMAT = pyaudio.paInt16
DOWNSAMPLE = False
DOWNSAMPLE_RATE = 16000

# Uncomment this to use the built-in mic and speakers jacks
'''
DEVICE_NAME = "HDA Intel PCH"
RATE = 48000
NUM_CHANNELS = 2
CHUNK_SIZE = 8192
FORMAT = pyaudio.paInt16
DOWNSAMPLE = True
DOWNSAMPLE_RATE = 16000
'''

# Uncomment this to use the Kinect
'''
DEVICE_NAME = "Kinect USB Audio"
RATE = 16000
NUM_CHANNELS = 4
CHUNK_SIZE = 1024
DOWNSAMPLE = False
DOWNSAMPLE_RATE = 8000
'''

################################################################################

# URLs for speech recognition servers and speech synthesizer
LEARNING_ADDWORD_URL = "http://sls-quad-19.csail.mit.edu:8000"
LEARNING_RECOGNIZER_URL = "http://sls-quad-19.csail.mit.edu:9000"
COMMANDS_RECOGNIZER_URL = "http://sls-quad-19.csail.mit.edu:9001/RPC2"
SYNTHESIZER_URL="http://people.csail.mit.edu/cyphers/cgi/zed.cgi?synth_string="

################################################################################

# Speech is detected if the smoothed energy distance is over this threshold
# Set this to None to automatically determine an appropriate threshold
#THRESHOLD = 100000.0
THRESHOLD = None

# If threshold is set to auto-detect, this multiplier will be applied to the
# average smoothed energy distance of the ambient sound.
THRESHOLD_MULTIPLIER = 30.0

# Calculate smoothed energy distance over this many frames for VAD
FRAME_BUFFER_LEN = 10

# How many frames we measure ambient noise for VAD
NOISE_MEASURE_FRAMES = 10

# Trim this many seconds off the end of audio files
END_TRIM_TIME = 0#.9

# Name of temp wave file that we save
WAV_FILENAME = "temp"

# Relative location of HARK localization file
LOC_PATH = "src/localization_WAV.n"

################################################################################
